package com.yl.danmo.controller;


import com.yl.common.core.utils.poi.ExcelUtil;
import com.yl.common.core.web.controller.BaseController;
import com.yl.common.core.web.domain.AjaxResult;
import com.yl.common.core.web.page.TableDataInfo;
import com.yl.common.log.annotation.Log;
import com.yl.common.log.enums.BusinessType;
import com.yl.common.security.annotation.RequiresPermissions;
import com.yl.danmo.domain.DanmoPersonInfo0;
import com.yl.danmo.service.IDanmoPersonInfo0Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 会员详情0Controller
 * 
 * @author yl
 * @date 2025-04-12
 */
@RestController
@RequestMapping("/personInfo0")
public class DanmoPersonInfo0Controller extends BaseController
{
    @Autowired
    private IDanmoPersonInfo0Service danmoPersonInfo0Service;

    /**
     * 查询会员详情0列表
     */
    @RequiresPermissions("system:personInfo0:list")
    @GetMapping("/list")
    public TableDataInfo list(DanmoPersonInfo0 danmoPersonInfo0)
    {
        startPage();
        List<DanmoPersonInfo0> list = danmoPersonInfo0Service.selectDanmoPersonInfo0List(danmoPersonInfo0);
        return getDataTable(list);
    }

    /**
     * 导出会员详情0列表
     */
    @RequiresPermissions("system:personInfo0:export")
    @Log(title = "会员详情0", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DanmoPersonInfo0 danmoPersonInfo0)
    {
        List<DanmoPersonInfo0> list = danmoPersonInfo0Service.selectDanmoPersonInfo0List(danmoPersonInfo0);
        ExcelUtil<DanmoPersonInfo0> util = new ExcelUtil<DanmoPersonInfo0>(DanmoPersonInfo0.class);
        util.exportExcel(response, list, "会员详情0数据");
    }

    /**
     * 获取会员详情0详细信息
     */
    @RequiresPermissions("system:personInfo0:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(danmoPersonInfo0Service.selectDanmoPersonInfo0ById(id));
    }

    /**
     * 新增会员详情0
     */
    @RequiresPermissions("system:personInfo0:add")
    @Log(title = "会员详情0", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DanmoPersonInfo0 danmoPersonInfo0)
    {
        return toAjax(danmoPersonInfo0Service.insertDanmoPersonInfo0(danmoPersonInfo0));
    }

    /**
     * 修改会员详情0
     */
    @RequiresPermissions("system:personInfo0:edit")
    @Log(title = "会员详情0", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DanmoPersonInfo0 danmoPersonInfo0)
    {
        return toAjax(danmoPersonInfo0Service.updateDanmoPersonInfo0(danmoPersonInfo0));
    }

    /**
     * 删除会员详情0
     */
    @RequiresPermissions("system:personInfo0:remove")
    @Log(title = "会员详情0", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(danmoPersonInfo0Service.deleteDanmoPersonInfo0ByIds(ids));
    }
}
